/**
 * @author Isabella Nake (isabella.nake@usi.ch)
 * @author Nicolas Lusa (lusan@usi.ch)
 */
package ch.usi.inf.pf2.circuit;

import ch.usi.inf.pf2.time.ComputeEvent;
import ch.usi.inf.pf2.time.Schedule;

public class InputPinForGate extends InputPin {
	private static final long serialVersionUID = 8808731807375154549L;
	private final Gate gate;
	
	public InputPinForGate(final Gate gate) {
		this.gate = gate;
	}
	
	//MODEL PART
	
	@Override
	public void setValue(final Value value) {
		this.value = value;
		gate.setValue(value, this);
		new ComputeEvent(value, gate, Schedule.getStep() + gate.getDelay());
	}
	
	public void removeInputPin() {
		gate.removeInputPin(this);
	}
	
	
}
